# This file is part of rehash
# Copyright (C) 2020 Maxime Devos (<maxime.devos@student.kuleuven.be>)
# SPDX-License-Identifier: FSFAP
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.  This file is offered as-is,
# without any warranty.

AC_PREREQ([2.61])
AC_INIT([rehash], [0], [])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])

AM_INIT_AUTOMAKE([foreign subdir-objects])

AC_CONFIG_HEADERS([rehash_config.h])
AC_PROG_CC

# Dynamic library support
# TODO: doesn't pick up system libtool automatically
LT_INIT

# Check for GNUnet libraries
PKG_CHECK_MODULES([GNUNETDHT],  [gnunetdht])
PKG_CHECK_MODULES([GNUNETUTIL], [gnunetutil])
PKG_CHECK_MODULES([GNUNETDATASTORE], [gnunetdatastore])
# TODO perhaps include gnunetcrypto as well
# And some GNUnet dependencies
PKG_CHECK_MODULES([LIBEXTRACTOR], [libextractor])

# Check for Guile presence
# TODO perhaps implement some language bindings:
#  [ ] haskell
#  [ ] guile (+ other schemes) (<-- priority)
#  [ ] common lisp
#  [ ] emacs
#  [ ] rust

GNUNETUTIL_LIBDIR="`$PKG_CONFIG --variable libdir gnunetutil`"
AC_SUBST([GNUNETUTIL_LIBDIR])
AC_CONFIG_FILES([scheme-binding/rehash/config.scm])

AC_OUTPUT([Makefile])
